package com.jason.kotlin.notification

import android.os.Bundle
import android.widget.Button
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import com.jason.kotlin.R
import kotlinx.android.synthetic.main.activity_notification.*

/**
 * Description:NotificationActivity
 *
 * @author chenbaoyang
 * @create 2020/12/15 15:31
 */
class NotificationActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_notification)

        notify_message.setOnClickListener {
            Toast.makeText(this, "已推送，可下拉抽屉通知栏查看", Toast.LENGTH_LONG).show()
            NotificationHelper.notifyMessage(
                this,
                1,
                "MadChan",
                "这是一条聊天消息"
            )
        }

        notify_mention.setOnClickListener {
            Toast.makeText(this, "将在3s后推送，可锁定屏幕查看", Toast.LENGTH_LONG).show()
            it.postDelayed({
                NotificationHelper.notifyMention(
                    this,
                    2,
                    "MadChan",
                    "这是一条@提醒消息"
                )
            }, 3000)
        }

        notify_notice.setOnClickListener {
            Toast.makeText(this, "已推送，可下拉抽屉通知栏查看", Toast.LENGTH_LONG).show()
            NotificationHelper.notifyNotice(
                this,
                3,
                "系统通知",
                "MadChan想加你为好友"
            )
        }

        notify_call.setOnClickListener {
            Toast.makeText(this, "将在3s后推送，可锁定屏幕查看", Toast.LENGTH_LONG).show()
            it.postDelayed({
                NotificationHelper.notifyCall(this, 4, "MadChan", "[视频通话]")
            }, 3000)
        }
    }
}